define(function (require, exports, module) {
	
	//组合框组
	var IntInputGroup=function(minNumberInputSelector,maxNumberInputSelector){
		this.minNumber=null;
		this.maxNumber=null;
		

		
		this.actionName=""
		
		this.minNumberInputSelector=minNumberInputSelector
		this.maxNumberInputSelector=maxNumberInputSelector
		
		this.minNumber=$(this.minNumberInputSelector).get(0).value
		this.maxNumber=$(this.maxNumberInputSelector).get(0).value
		
		
		this.regExp=new RegExp("^([1-9][\\d]{0,11}|0)?$");
		
		var self=this;
		var options={
			
		};
		
		$(this.minNumberInputSelector).bind("change",function(event){self.minNumberInputChangeHandle(event);})
		$(this.maxNumberInputSelector).bind("change",function(event){self.maxNumberInputChangeHandle(event);})
	}
	IntInputGroup.prototype.checkNumber=function(checkName){
		//var minNumber,endValue
		this.minNumber=$(this.minNumberInputSelector).val()
		this.maxNumber=$(this.maxNumberInputSelector).val()
		
		//alert(minNumber+" "+endValue);
		
		if(this.minNumber!=null && this.maxNumber!=null && this.minNumber!="" && this.maxNumber!=""){
			if(parseFloat(this.minNumber) > parseFloat(this.maxNumber)){
				if(checkName=="minNumber"){
					alert("最小值不能大于最大值");
					this.minNumber=null;
					$(this.minNumberInputSelector).get(0).value=""
				}else{
					alert("最大值不能小于最小值");
					this.maxNumber=null;
					$(this.maxNumberInputSelector).get(0).value=""
				}
			};
		}
	}
	IntInputGroup.prototype.setMinNumber=function(minNumber){
		this.minNumber=minNumber;
		this.checkNumber("minNumber");
	}
	IntInputGroup.prototype.setMaxNumber=function(maxNumber){
		
		this.maxNumber=maxNumber;
		this.checkNumber("maxNumber");
	}
	IntInputGroup.prototype.regExp=null;
	
	IntInputGroup.prototype.minNumberInputChangeHandle=function(event){
		var value=event.target.value
		if(value!=0){
			if(this.regExp.test(value)){
				this.setMinNumber(value);
			}else{
				alert("请填入整数格式");
				event.target.value="";
			}
		}
	}
	IntInputGroup.prototype.maxNumberInputChangeHandle=function(event){
		var value=event.target.value
		if(value!=0){
			if(this.regExp.test(value)){
				this.setMaxNumber(value);
			}else{
				alert("请填入整数格式");
				event.target.value="";
			}
		}
	}
	module.exports = IntInputGroup;
})